<template>
    <div>
        <el-container>
            <el-header>
                <Header></Header>
            </el-header>
            <el-container>
                <el-aside style="width: 200px" :style="'height:'+ (fullHeight - 60) + 'px;'">
                    <adminNav v-show="adminNav"></adminNav>
                    <superAdminNav v-show="superAdminNav"></superAdminNav>
                    <accountingNav v-show="accountingNav"></accountingNav>
                </el-aside>
                <el-main :style="'height:'+ (fullHeight - 60) + 'px;'">
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
    import superAdminNav from '../../components/backgroundCom/superAdminNav'
    import adminNav from '../../components/backgroundCom/adminNav'
    import accountingNav from '../../components/backgroundCom/accountingNav'
    import {mapGetters} from 'vuex'
    import Header from '../../components/publicCom/header'
    export default {
        name: "index",
        components:{
            superAdminNav,adminNav,accountingNav,Header
        },
        data(){
            return{
                superAdminNav:false,
                adminNav:false,
                accountingNav:false,
                fullHeight:document.documentElement.clientHeight
            }
        },
        computed:{
        },
        methods:{
            ...mapGetters(['getPower']),
        },
        created() {
            if(this.getPower() === 1 ){
                this.adminNav = true
                this.superAdminNav = false
                this.accountingNav = false
            }else if(this.getPower() === 2 ){
                this.superAdminNav = true
                this.adminNav = false
                this.accountingNav = false
            }else if(this.getPower() === 3 ){
                this.accountingNav = true
                this.adminNav = false
                this.superAdminNav = false
                this.$router.push('/back/financialManagement')
            }
        },
        mounted(){
            const that = this
            window.onresize = ()=>{
                return (()=>{
                    window.fullHeight = document.documentElement.clientHeight
                    that.fullHeight = window.fullHeight
                })()
            }
        },
    }
</script>

<style scoped lang="less">

</style>